<?php

namespace Product\Form;

use Zend\Form\Form;
use Zend\Stdlib\Hydrator\ClassMethods;

class ProductForm extends Form
{
    public function __construct($name = nul) {
        parent::__construct('product');
        
        $this->setAttribute('method', 'post');
        $this->setInputFilter(new ProductFilter());
        $this->setHydrator(new ClassMethods());
        
        $this->add(array(
            'name' => 'id' ,
            'type' => 'hidden'
        ));
        
        $this->add(array(
            'name' => 'name',
            'type' => 'text' ,
            'options' => array(
                'label' => 'Ten',
            ),
            'attributes' => array(
                'class' => 'form-control' ,
                'data-ng-model' => 'product.name'
            ) ,
        ));
        
        $this->add(array(
            'name' => 'description' ,
            'type' => 'textarea' ,
            'options' => array(
                'label' => 'Mo ta'
            ),
            'attributes' => array(
                'class' => 'form-control' ,
                'data-ng-model' => 'product.description'
            ),
        ));
        
        $this->add(array(
            'name' => 'submit' ,
            'type' => 'submit' ,
            'attributes' => array(
                'class' => 'btn btn-primary'
            ),
        ));
    }
}